<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>美多商城-用户中心</title>
	<link rel="stylesheet" type="text/css" href="/static/css/reset.css">
	<link rel="stylesheet" type="text/css" href="/static/css/main.css">
    <script type="text/javascript" src="/static/js/host.js"></script>
	<script type="text/javascript" src="/static/js/vue-2.5.16.js"></script>
    <script type="text/javascript" src="/static/js/axios-0.18.0.min.js"></script>
</head>
<body>
	<div id="app" v-cloak>
	<div class="header_con">
		<div class="header">
			<div class="welcome fl">欢迎来到美多商城!</div>
			<div class="fr">
                <div v-if="username" class="login_info fl">
                    欢迎您：<em>[[username]]</em>
                </div>
                <div v-else class="login_btn fl">
                    <a href="/login/">登录</a>
                    <span>|</span>
                    <a href="/register/">注册</a>
                </div>
                <div class="user_link fl">
                    <span>|</span>
                    <a href="/info/">用户中心</a>
                    <span>|</span>
                    <a href="/carts/">我的购物车</a>
                    <span>|</span>
                    <a href="/orders/info/1/">我的订单</a>
                </div>
            </div>
		</div>		
	</div>

	<div class="search_bar clearfix">
		<a href="index.html" class="logo fl"><img src="/static/images/logo.png"></a>
		<div class="search_wrap fl">
			<form method="get" action="/search/" class="search_con">
                <input type="text" class="input_text fl" name="q" placeholder="搜索商品">
                <input type="submit" class="input_btn fr" name="" value="搜索">
            </form>
			<ul class="search_suggest fl">
				<li><a href="#">索尼微单</a></li>
				<li><a href="#">优惠15元</a></li>
				<li><a href="#">美妆个护</a></li>
				<li><a href="#">买2免1</a></li>
			</ul>
		</div>		
	</div>

	<div class="main_con clearfix">
		<div class="left_menu_con clearfix">
			<h3>用户中心</h3>
			<ul>
				<li><a href="/info/">· 个人信息</a></li>
				<li><a href="/orders/info/1/">· 全部订单</a></li>
				<li><a href="/addresses/" class="active">· 收货地址</a></li>
				<li><a href="/password/">· 修改密码</a></li>
			</ul>
		</div>
		<div class="right_content clearfix">
			<div class="site_top_con">
				<a href="javascript:;" @click="show_add_site()">新增收货地址</a>
				<span>你已创建了<b>[[addresses.length]]</b>个收货地址，最多可创建<b>20</b>个</span>
			</div>
			<div v-for="(address,index) in addresses" class="site_con">
				<div class="site_title">
                    <div v-if="edit_title_index===index">
                        <input v-model="input_title" type="text" name="">
                        <input @click="save_title(index)" type="button" name="" value="保 存">
                        <input @click="cancel_title(index)" type="reset" name="" value="取 消">
                    </div>
					<h3>[[address.title]]</h3>
					<a href="javascript:;" class="edit_icon" @click="show_edit_title(index)"></a>
					<em v-if="address.id==default_address_id">默认地址</em>
					<span class="del_site" @click="delete_address(index)">×</span>
				</div>
				<ul class="site_list">
					<li><span>收货人：</span><b>[[address.receiver]]</b></li>
					<li><span>所在地区：</span><b>[[address.province]][[address.city]][[address.district]]</b></li>
					<li><span>地址：</span><b>[[address.place]]</b></li>
					<li><span>手机：</span><b>[[address.mobile]]</b></li>
					<li><span>固定电话：</span><b>[[address.tel]]</b></li>
					<li><span>电子邮箱：</span><b>[[address.email]]</b></li>
				</ul>
				<div class="down_btn">
					<a href="javascript:;" class="set_default" @click="set_default(index)">设为默认</a>
					<a href="javascript:;" class="edit_icon" @click="show_edit_site(index)">编辑</a>
				</div>
			</div>


		</div>
	</div>
	<div class="footer">
		<div class="foot_link">
			<a href="#">关于我们</a>
			<span>|</span>
			<a href="#">联系我们</a>
			<span>|</span>
			<a href="#">招聘人才</a>
			<span>|</span>
			<a href="#">友情链接</a>		
		</div>
		<p>CopyRight © 2016 北京美多商业股份有限公司 All Rights Reserved</p>
		<p>电话：010-****888    京ICP备*******8号</p>
	</div>

	<div class="pop_con" v-show="is_show_edit">
		<div class="site_con site_pop">
				<div class="site_pop_title">
					<h3>[[add_title]]收货地址</h3>
					<a href="javascript:;" @click="is_show_edit=false">×</a>
				</div>				
				<form>
					<div class="form_group">
						<label>收货人：</label>
						<input type="text" name="receiver" class="receiver" v-model="form_address.receiver" @blur="check_receiver()">
                        <span class="receiver_error" v-show="error_receiver">请填写收货人</span>
					</div>
					<div class="form_group">
                        <label>*所在地区：</label>
                        <select v-model="form_address.province_id">
                            <option v-for="province in provinces" :value="province.id">[[ province.name ]]</option>
                        </select>
                        <select v-model="form_address.city_id">
                            <option v-for="city in cities" :value="city.id">[[ city.name ]]</option>
                        </select>
                        <select v-model="form_address.district_id">
                            <option v-for="district in districts" :value="district.id">[[ district.name ]]</option>
                        </select>
                    </div>
					<div class="form_group">
						<label>详细地址：</label>
						<input type="text" name="place" class="place" v-model="form_address.place" @blur="check_place()">
                        <span class="place_error" v-show="error_place">请填写详细地址</span>
					</div>
					<div class="form_group">
						<label>手机：</label>
						<input type="text" name="mobile" class="mobile" v-model="form_address.mobile" @blur="check_mobile()">
                        <span class="mobile_error" v-show="error_mobile">手机号有误</span>
					</div>
					<div class="form_group">
						<label>固定电话：</label>
						<input type="text" name="tel" class="tel" v-model="form_address.tel" @blur="check_tel()">
                        <span class="tel_error" v-show="error_tel">固定电话有误</span>
					</div>
					<div class="form_group">
						<label>邮箱：</label>
						<input type="text" name="email" class="email" v-model="form_address.email" @blur="check_email()">
                        <span class="email_error" v-show="error_email">邮箱格式有误</span>
					</div>
					<input type="button" name="" :value="add_title" @click="save_address()" class="info_submit">
					<input type="reset" name="" value="取 消" @click="is_show_edit=false" class="info_submit info_reset">
				</form>
		</div>
		<div class="mask"></div>
	</div>

	<div class="pop_con2">
		<div class="confirm_pop">
				<div class="confirm_pop_title">
					<h3>确认删除</h3>
					<a href="javascript:;">×</a>
				</div>
				<p>您确认删除当前地址吗？</p>
				<input type="button" value="确 定" class="confirm_submit" />
				<input type="button" value="取 消" class="confirm_submit confirm_cancel"  />
		</div>
		<div class="mask"></div>
	</div>
	</div>
    <script>
        var addresses = {{ addresses | safe }}
        var default_address_id = "{{ default_address_id }}"
    </script>
    <script type="text/javascript" src="/static/js/common.js"></script>
	<script type="text/javascript" src="/static/js/user_center_site.js"></script>
</body>
</html>